﻿using System.Collections.Generic;
using System.Linq.Expressions;
using Light.Framework.Model;

namespace Light.Framework
{
    /// <summary>
    /// 数据访问基接口
    /// </summary>
    /// <typeparam name="T"></typeparam>
    public interface IDataAccess<T>
    {
        /// <summary>
        /// 新增
        /// </summary>
        /// <param name="obj"></param>
        void Insert(T obj);

        /// <summary>
        /// 批量增加
        /// </summary>
        /// <param name="objs"></param>
        void Insert(List<T> objs);

        /// <summary>
        /// 更新
        /// </summary>
        /// <param name="obj"></param>
        void Update(T obj);

        /// <summary>
        /// 批量更新
        /// </summary>
        /// <param name="objs"></param>
        void Update(List<T> objs);

        /// <summary>
        /// 删除
        /// </summary>
        /// <param name="obj"></param>
        void Delete(T obj);

        /// <summary>
        /// 批量删除
        /// </summary>
        /// <param name="objs"></param>
        void Delete(List<T> objs);
        /// <summary>
        /// 查看详细
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        T SelectById(int id);

        /// <summary>
        /// 查看所有数据
        /// </summary>
        /// <param name="tenantId"></param>
        /// <returns></returns>
        List<T> SelectAll();

        /// <summary>
        /// 查询
        /// </summary>
        /// <param name="exp"></param>
        /// <returns></returns>
        List<T> Select(SearchArgs args);

        ///// <summary>
        ///// 获取最大的ID
        ///// </summary>
        ///// <param name="prefix"></param>
        ///// <returns></returns>
        //string GetLevel1NewId(string itemType, string userId, string tenantId);

        ///// <summary>
        ///// 获取一级的ID
        ///// </summary>
        ///// <param name="itemType"></param>
        ///// <param name="tenantId"></param>
        ///// <returns></returns>
        //string GetLevel2NewId(string itemType, string tenantId);

        ///// <summary>
        ///// 查看状态
        ///// </summary>
        ///// <param name="id"></param>
        ///// <returns></returns>
        //int GetState(string id);

        ///// <summary>
        ///// 设置状态
        ///// </summary>
        ///// <param name="id"></param>
        ///// <param name="state"></param>
        ///// <returns></returns>
        //void SetState(string id, int state);
    }
}
